
    import Vue from "vue"; 
    import VueRouter from "vue-router";
    import Home from '../views/Home/home.vue'
    // 注册插件

    Vue.use(VueRouter)  //VueRouter和vue关联

    //创建路由表
    let routes = [
        {
            path:'/',
            component:Home
        },
        {
            path:'/search',//搜索
            component:()=>import ('../views/Search/search.vue') //路由懒加载
        },
        {
            path:'/cart',//购物车
            component:()=>import ('../views/Cart/cart.vue') //路由懒加载
        },
        {
            path:'/login',//登录
            component:()=>import ('../views/Login/login.vue') //路由懒加载
        },
        {
            path:'/proclass',//分类
            component:()=>import ('../views/proClass/proClass.vue') //路由懒加载
        },
        {
            path:'/shopdes',//商品详情页
            component:()=>import ('../views/shopDetail/shopDes') //路由懒加载
        },
        {
            path:'/my',//我的
            component:()=>import ('../views/My/my') //路由懒加载
        },
    ]

    //创建路由实例
    let router = new VueRouter({
        routes,
        mode:'history'
    })

    // 暴露
    export default router

    //解决重复点击当前路由报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
